package jmine.tec.hydra.builders;

import jmine.tec.hydra.domain.HydraSystem;
import jmine.tec.hydra.domain.specification.HydraSpecificationImpl;
import jmine.tec.test.Builder;

public class SpecificationBuilder implements Builder<HydraSpecificationImpl> {

    private String action = "action";

    private boolean disabled;

    private Builder<HydraSystem> systemBuilder = new SystemBuilder();

    public static SpecificationBuilder aSpec() {
        return new SpecificationBuilder();
    }

    public HydraSpecificationImpl build() {
        HydraSpecificationImpl spec = new HydraSpecificationImpl(this.action, this.systemBuilder.build());
        if (this.disabled) {
            spec.disable();
        }
        return spec;
    }

    public SpecificationBuilder withAction(String action) {
        this.action = action;
        return this;
    }

    public SpecificationBuilder fromSystem(Builder<HydraSystem> builder) {
        this.systemBuilder = builder;
        return this;
    }

    public SpecificationBuilder disabled() {
        this.disabled = true;
        return this;
    }

    public SpecificationBuilder enabled() {
        this.disabled = false;
        return this;
    }
}
